package demon4;

public class Lottery implements  Runnable{
    int ticket=0;
    @Override
    public void run() {
        while(true){
            if(ticket<100){
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                ticket++;
                System.out.println(Thread.currentThread().getName()+"正在卖第"+ticket+"张票");
            }else{
                break;
            }
        }
    }
}
